﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Line.aspx.cs" Inherits="Jy123.Web.Manage.Line" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>管理队服图案</title>
    <link href="css/custom/jquery.ui.css" rel="stylesheet" type="text/css" />
    <link href="css/main.css" rel="stylesheet" type="text/css" />

    <script src="js/jquery.js" type="text/javascript"></script>

    <script src="js/jquery.ui.js" type="text/javascript"></script>

    <script src="js/main.js" type="text/javascript"></script>

    <script type="text/javascript" language="javascript">
    function Validate(){ 
        var fileUpload=document.getElementById('<%=fileUpload.ClientID %>');
        var actionHidden=document.getElementById('<%=actionTypeHidden.ClientID %>');
        var button=document.getElementById('<%=SaveButton.ClientID %>');
        button.disabled="";        
        if(fileUpload.value==''){        
            if(actionHidden.value=='Add'){
                $("#noLogoSpan").css('display','block');
                $("#errorLogoSpan").css('display','none');
                button.disabled="disabled";
                return false;
            }
        }else{
            $("#noLogoSpan").css('display','none');
           var fileName=fileUpload.value;
           var index=fileName.lastIndexOf(".")+1;
           var length=fileName.length-fileName.lastIndexOf(".")-1;                                                  
           var fileType=fileName.substr(index,length);           
           if(fileType=='jpg'||fileType=='gif'||fileType=='tiff'||fileType=='jpeg'||fileType=='png'||fileType=='bmp'){
                $("#errorLogoSpan").css('display','none');                
                $("#lineImage").attr("src",fileUpload.value)                 
           }else{
                $("#errorLogoSpan").css('display','block');
                button.disabled="disabled";
                return false; 
           }          
        }
        
      }
    </script>

</head>
<body>
    <h4>
        <a href="#"><span>队服图案管理</span></a></h4>
    <form id="manageJTypeForm" runat="server">
    <div class="register">
        <h5>
            运动类型
        </h5>
        <ul>
            <li>
                <asp:DropDownList ID="sportTypeDropDown" runat="server">
                </asp:DropDownList>
            </li>
            <li>
                <asp:RequiredFieldValidator ID="sportTypeRequired" CssClass="warning" runat="server"
                    ControlToValidate="sportTypeDropDown" ErrorMessage="请选择运动类型" Display="Dynamic"
                    ForeColor="" InitialValue="-1"></asp:RequiredFieldValidator>
            </li>
        </ul>
        <h5>
            队服图案名称
        </h5>
        <ul>
            <li>
                <asp:TextBox ID="lineNameTextBox" runat="server" MaxLength="20" CssClass="text" onblur="Validate()"></asp:TextBox>
            </li>
            <li>
                <asp:RequiredFieldValidator ID="lineNameRequired" CssClass="warning" runat="server"
                    ControlToValidate="lineNameTextBox" ErrorMessage="请填写队服图案名称" Display="Dynamic"
                    ForeColor=""></asp:RequiredFieldValidator>
            </li>
        </ul>
        <h5>
            队服图案
        </h5>
        <ul>
            <li>
                <asp:FileUpload ID="fileUpload" CssClass="text" runat="server" onchange="Validate()" />
            </li>
            <li>
                <img id="lineImage" runat="server" alt="" src="" style="width: 150px; height: 101px;
                    margin-left: 70px; border: 1px solid rgb(211, 211, 211); margin-bottom: 15px;" />
            </li>
            <li><span id="noLogoSpan" class="warning" style="display: none">请上传一张图片</span> <span
                id="errorLogoSpan" class="warning" style="display: none">请选择正确的图片格式</span></li>
        </ul>
        <ul>
            <li>
                <asp:HiddenField ID="actionTypeHidden" runat="server" Value="Add" />
                <asp:HiddenField ID="idHidden" runat="server" />
                <asp:Button ID="SaveButton" runat="server" CssClass="button" Text="保存" OnClick="Save" />
            </li>
        </ul>
    </div>
    <asp:Repeater ID="lineRepeater" runat="server" Visible="false" OnItemDataBound="Repeater_DataBound"
        OnItemCommand="Repeater_Command">
        <HeaderTemplate>
            <table class="tblist">
                <tr>
                    <th>
                        运动类型
                    </th>
                    <th>
                        队服图案名称
                    </th>
                    <th>
                        队服图案
                    </th>
                    <th>
                    </th>
                </tr>
        </HeaderTemplate>
        <ItemTemplate>
            <tr>
                <td>
                    <asp:Label ID="sportTypeLabel" runat="server"></asp:Label>
                </td>
                <td>
                    <asp:HiddenField ID="idHidden" runat="server" />
                    <asp:Label ID="lineNameLabel" runat="server"></asp:Label>
                </td>
                <td>
                    <asp:Image ID="lineImage" runat="server" />
                </td>
                <td>
                    <asp:LinkButton ID="EditButton" runat="server" CssClass="btnsty" CausesValidation="false"
                        CommandName="Edit" Text="修改" />
                    <asp:LinkButton ID="DeleteButton" runat="server" CssClass="btnsty cred" CausesValidation="false"
                        CommandName="Delete" Text="删除" OnClientClick="return confirm('确定删除？')" />
                </td>
            </tr>
        </ItemTemplate>
        <FooterTemplate>
            </table>
        </FooterTemplate>
    </asp:Repeater>
    </form>
</body>
</html>
